1. Field of the Invention
The present invention relates to a control technique in an encoding process for encoding digital image data to convert the digital image data into encoded data having a predetermined data amount.
2. Description of the Related Art
A number of apparatuses are equipped with the function of compression encoding a still image. Digital cameras are available as a typical example of such apparatuses. Many digital copying apparatuses have also the function of compression encoding.
In such a digital copying apparatus, a document reader reads an original document and image using an optical sensor or the like, and source image data is reproduced by performing a diversity of image processes.
When the source image data is transferred to a printer, the amount of data to be transferred is reduced. The document reader is thus provided with the function of compression encoding the source image data.
On the other hand, the printer is provided with the function of decompression decoding for decoding an encoded data stream.
The amount of data of the encoded data stream obtained through the compression encoding process is typically smaller than a fraction of the amount of the image data prior to the compression coding process, i.e., a fraction of the amount of the source image data.
It is preferred that a distortion due to the compression encoding (an image degradation) is as small as a value (a compression rate) that cannot be easily recognized from reconstructed image data (a decoded image) obtained through a decompression decoding process. That value is preferably adopted as an upper limit of the compression rate.
A lower limit permitted as the compression rate depends on factors, such as the maximum amount of source image data formed by the document reader per predetermined unit time, and the maximum amount of encoded data transferred from the document reader to the printer, namely, the performance of the processing system.
The upper limit and lower limit of the compression rate, namely, a permissible range of the compression rate, is thus determined. However, it is extremely difficult to restrict in practice the compression rate of the source image data formed in the document reader to within the permissible range.
Even if the same quantization table affecting the compression rate is used to compression encode the source image data of the same size, the amount of the resulting encoded data becomes different from source image data to source image data. In other words, the source image data changes depending on the content of the image.
To maintain the compression rate at a constant value, an encoding parameter (such as a quantization table) must be modified to an appropriate value each time each source image data is compressed.
Two techniques, a feed-forward method and feedback method, are available to control the compression rate (the amount of encoded data).
In the feed-forward method, the source image data, input as data to be encoded, is analyzed prior to compression encoding, an encoding parameter is estimated based on the analysis result, and compression encoding is performed using the parameter.
In the feed-back method, a trial compression encoding process is performed using a predetermined encoding parameter, an appropriate encoding parameter is estimated based on the amount of the resulting encoded data, and an actual compression encoding process is performed using the estimated parameter.
The latter feedback method achieves a target encoded data amount with a probability higher than the feed-forward method because the feedback method uses the actual data amount of encoded data.
The feedback method needs more time because of the trial compression encoding thereof.
Japanese Patent Laid-Open No. 02-100487 (Japanese Patent Publication No. 08-032037) discloses a technique which repeats a compression encoding process until a target compression rate (encoded data amount) results. Real-time processing is not considered in this disclosure.
Real-time processing is typically required of apparatuses, such as a digital camera or a digital copying apparatus. The above-mentioned simple repetition process is not appropriate for these apparatuses.
An optimum encoding parameter must be precisely predicted in the feedback method that controls the compression rate (the encoded data amount). To this end, a plurality of trial compression encoding processes are performed by several times using a plurality of different encoding parameters. It is effective if the number of combinations of the encoding parameter in use and the data amount of the encoded data (actually measured value) corresponding to the encoding parameter is increased. To minimize extra time required to predict the parameter, calculation circuits or processing circuits, of the same number as the number of encoding parameters used in the trial compression encoding, must be arranged. The circuits are run in parallel to shorten prediction time.
An article entitled “HDTV CODER/DECODER COMPATIBLE WITH 60–140 MBPS” 1992 January Issue of Journal of Imaging and Information Technology discloses a compression coder which includes N quantizers and N measurement circuits for measuring amount of generated codes, and uses N combinations of quantization tables. An optimum quantization table is obtained by using a curve fitting based on the amount of N pieces of encoded data.
Japanese Patent No. 02523953 discloses a technique which uses three quantizers and performs quantization in parallel using five combinations of quantization tables during a trial compression coding, and thus calculates five values of encoded data amount.
An encoding method for successively encoding image data by dynamically changing the scaling factor for a quantization table, namely, a motion image compression coding method using a so-called MPEG may be used to compression encode a single piece of image data. U.S. Pat. No. 5,543,844 (corresponding to Japanese Patent No. 02897563) discloses such an encoding method and uses a successive correction algorithm for an encoding parameter. In this disclosed technique, the amount of encoded data obtained block by block from quantization calculation using a particular quantization scaling factor is measured. M encoded data amounts expected to be obtained from M quantization scaling factors based on the measured data amount are predicted. A quantization scaling factor to be actually used is successively corrected based on a predicted error, namely, a difference between a target encoded data amount calculated from M predictive values and a cumulative value of data amount of an encoded data stream actually output up until now. A compression coding is thus performed on a single frame.
U.S. Pat. No. 5,291,282 (corresponding to Japanese Patent No. 03038022) discloses a technique which prevents an encoded data amount from exceeding a permitted upper limit against prediction. A quantization step value determined from an encoded data amount that is obtained in an trial compression encoding process is used. When the encoded data amount that is obtained through a quantization calculation and variable-length coding process exceeds a data amount assigned to each block, the variable-length coding process in that block is quit (effective transform coefficient information is discarded).
The control methods of the compression rate (the encoded data amount) using the above-mentioned conventional type feed-back method are common in that an optimum encoding parameter and a data amount of encoded data generated through the encoding process using the optimum encoding parameter are estimated based on one or a plurality of pieces of encoded data obtained through a trial compression encoding (actual measured value).
In the JPEG encoding method which is a typical still image compressing encoding method, it is regulated that “a single quantization table is commonly applied to all blocks constituting a single piece of source image data” when a quantization table as the most typical encoding parameter is applied.
The technique of selecting an encoding parameter disclosed in U.S. Pat. No. 5,543,844 cannot be applied if there is a requirement that a compression encoding method with the freedom of selecting an encoding parameter limited be adopted, as in the above-mentioned JPEG.
In the algorithm disclosed in U.S. Pat. No. 5,291,282, it is determined whether or not a data amount assigned to each block is exceeded on a block by block basis. A variable-length coding is quit on a block by block basis. An effective orthogonal transform coefficient is discarded even if a final encoded data amount does not reach the upper permissible value when the compression coding of all blocks constituting the source image data is completed. As a result, a decoded image suffers from a localized distortion on a per block basis.
When the feed-back method having a high prediction accuracy is used, a conventional type parallel circuit architecture proves effective in a variety of apparatuses, of which real-time processing is required. However, the scale of the circuitry becomes large. A capacity of buffers which temporarily store a plurality of encoded data streams must be large, leading to a cost increase.
When the compression encoding process is performed on the still image on each of the above-discussed apparatuses, a difference in localized encoding distortion from one to another piece of the source image data (a visual image degradation) must be avoided.
In many cases, the encoding distortion is caused by quantization calculation. The JPEG coding scheme does not allow different quantization tables to be used on a block by block basis. Conversely, this constraint provides the advantage that the source image data is free from localized encoding distortion.
For this reason, the JPEG coding scheme is frequently used as a still image compression coding method in a digital camera or digital copying apparatus which handles a still image.
It is a good choice that a “re-encoding process function” is applied to perform a compression coding at a target compression rate with a high performance maintained in an apparatus that adopts “the compression encoding method with the freedom of selecting an encoding parameter limited” as in the above-mentioned JPEG.
A number of application methods of the “re-encoding process function” are available. The function and advantages of the re-encoding process become different depending on what status of the image data the re-encoding process is performed.
In the middle of the compression encoding of the single source image data (from the beginning of the encoding to the formation of final encoded data), the source image data itself or orthogonal transform coefficients prior to quantization are temporarily stored in a buffer. A technique of performing a re-encoding process using stored source image data or the orthogonal transport coefficient is known. However, this technique requires a large buffer capacity.